generate a better optimized query for path prefix search filters#28608
Merged
generate a better optimized query for path prefix search filters#28608
Conversation
Signed-off-by: Robin Appelman <robin@icewind.nl>
PVince81
approved these changes
Oct 5, 2021
Member
PVince81
left a comment
There was a problem hiding this comment.
Code looks fine 👍
Assuming this won't affect other database engines negatively
skjnldsv
approved these changes
Oct 7, 2021
CarlSchwan
approved these changes
Oct 7, 2021
Member
Author
|
/backport to stable22 |
Member
|
/backport to stable21 |
Member
|
/backport to stable20 |
|
The backport to stable21 failed. Please do this backport manually. |
|
The backport to stable20 failed. Please do this backport manually. |
Member
Author
|
see #29080 for the 21 and 20 backports |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If we're already doing a
path LIKE "$prefix/%"then doing apath = "$prefix"doesn't incur the cost it normally does compared topath_hash = md5("$prefix"), and by only selecting on thepathcolumn instead of 2 columns the same index can be used for both comparisons.Combined with #28541 this gets mysql to do a proper indexed search (in my testing at least)